{extend name="public:base" /}
{block name="style"}
<link rel="stylesheet" type="text/css" href="__INDEX__/css/public.css">
<link rel="stylesheet" type="text/css" href="__INDEX__/css/style.css">
<link rel="stylesheet" type="text/css" href="__INDEX__/css/responsive.css">
<link rel="shortcut icon" href="__INDEX__/images/favorite.ico">
<link rel="stylesheet" type="text/css" href="__COMMON__/css/style.css">
{/block}
{block name="html"}
{include file="index@public/main" /}
<div class="right_style">
    <h3 class="title_style"><em></em><span>添加地址</span></h3>
<!-- <h1 class="h1">{$headName}</h1> -->
<div class="dzgg">

    <form id="form" method="post" action='{:url("User/add_address")}'>
        <ul>
            <input type="hidden" name="jumpUrl" value="{$jumpUrl}">
            <input type="hidden" name="id" value="{$Arr['id']? $Arr['id'] : ''}"/>
            <li><input type="text" id="name" name="name" placeholder="收货人"  value="{$Arr['name']? $Arr['name'] : ''}" /></li>
            <li><input type="text" id="phone" name="phone" placeholder="联系电话"  value="{$Arr['phone']? $Arr['phone'] : ''}"/></li>
            <li><input type="text" id="zip_code" name="zip_code" placeholder="邮编"  value="{$Arr['zip_code']? $Arr['zip_code'] : ''}"/></li>
            <li>
                <div class="outer">
                    <select name="province"  id="province">
                        <option value="{$Arr['province']? $Arr['province'] : '请选择'}">{$Arr['province']? $Arr['province'] : '请选择'}</option>
                    </select>
                    <select name="city" id="city">
                        <option value="{$Arr['city']? $Arr['city'] : '请选择'}">{$Arr['city']? $Arr['city'] : '请选择'}</option>
                    </select>
                    <select name="town" id="town">
                        <option value="{$Arr['town']? $Arr['town'] : '请选择'}">{$Arr['town']? $Arr['town'] : '请选择'}</option>
                    </select>
                </div>
            </li>
            <li>
                <textarea id="address" name="address" type="text" placeholder="详细地址">{$Arr['address']? $Arr['address'] : ''}</textarea>
            </li>
        </ul>
    </form>
    <a href="javascript:;" onclick="submitFormFuc()">保存</a>
</div>
</div>
{/block}
{block name="javascript"}
<script src="__INDEX__/js/jquery-1.9.1.min.js"></script>
<script src="__INDEX__/js/public.js"></script>
<script src="__INDEX__/layer/layer.js"></script>
<script src="__COMMON__/js/area.js"></script>
<script src="__COMMON__/js/select.js"></script>
<script type="text/javascript">

    function submitFormFuc(){

        var name = $("#name").val();
        if( name == "" ){

            layer.msg("请输入收货人姓名",{icon: 2});
            return false;
        }
        var phone = $("#phone").val();
        var reg = /^0?1[3|4|5|7|8][0-9]\d{8}$/;
        if( !reg.test(phone) ){

            layer.msg("请输入正确的手机",{icon: 2});
            return false;
        }
        var zip_code = $("#zip_code").val();
        if( zip_code == "" || zip_code.length != 6 ){

            layer.msg("请输入正确的邮编",{icon: 2});
            return false;
        }
        var province = $("#province").val();
        if( province == "请选择" ){

            layer.msg("请选择地址",{icon: 2});
            return false;
        }
        var city = $("#city").val();
        if( city == "请选择" ){

            layer.msg("请选择地址",{icon: 2});
            return false;
        }
        var town = $("#town").val();
        if( town == "请选择" ){

            layer.msg("请选择地址",{icon: 2});
            return false;
        }

        var address = $("#address").val();
        if( address == "" || address == null ){
            layer.msg("请输入详细地址",{icon: 2});
            return false;
        }

        $("#form").submit();
    }


</script>

{/block}